package 算法.junit;

public class Test_DFA {
	String pat;
	public int search(String txt) {
		int[][] dfa = new int[5][5];
		int i, j, N = txt.length(), M = pat.length();
		for (i = 0, j = 0; i < N && j < M; i ++) {
			j = dfa[txt.charAt(i)][j];
		}
		if (j == M) return i - M;
		else return N;
	}
}
